From Inheritance to Feature Interaction or Composing Monads
نویسنده
چکیده
We show that techniques for monad composition can be used nicely for modeling object oriented programming concepts In this functional setting we develop a new model for composing objects from individual features in a modular way Features are similar to abstract subclasses but separate the core functionality of a subclass from overwriting meth ods We view method overwriting more generally as resolving interactions between two features The interaction handling is speci ed separately and added when features are composed This generalizes inheritance as found in object oriented languages and leads to a new view of objects in a func tional setting Our concepts are implemented in Gofer and generalize some monadic programming techniques where objects correspond to monads features to monad transformers and feature interactions are resolved by lifting functions through monad transformers
منابع مشابه
From Inheritance to Feature Interaction
In this paper we introduce a new model for composing objects from individual features in a fully exible and modular way Its main advantage is that di erent objects can be created just be selecting the desired features In addition there may be dependencies or interactions between features i e some feature must behave di erently in the presence of another one We present a modular solution to such...
متن کاملRecognisable Languages over Monads
The principle behind algebraic language theory for various kinds of structures, such as words or trees, is to use a compositional function from the structures into a finite set. To talk about compositionality, one needs some way of composing structures into bigger structures. It so happens that category theory has an abstract concept for this, namely a monad. The goal of this paper is to propos...
متن کاملLeibniz’s Monads and Mulla Sadra’s Hierarchy of Being: A Comparative Study
Mulla Sadra and Leibniz, the two philosophers from the East and the West, belong to two different worlds. Though they were unaware of the ideas of each other, their philosophical systems share certain common points that are comparable. Monads constitute the basis of Leibniz's thought and he refers to their features in his various works. On the other side, Mulla Sadra's philosophy is also based ...
متن کاملStructuring functional programs by using monads
The notion of monads originates from the category theory. It became popular in the programming languages community after Moggi proposed a way to use monads to structure denotational semantics. Wadler and others showed how this can be eeectively used as a methodology for building interpreters. Monads are capable of capturing individual language features in a modular way. This paper evaluates two...
متن کاملThe Different Aspects of Monads and Mixins
Around twenty years ago two important developments happened in the areas of modularity and reuse in programming languages. On the one hand, Moggi showed how computational effects found in impure languages could be simulated using the notion of monads from category theory. Inspired by Moggi’s work, Wadler showed how monads could be used to structure (purely functional) programs. On the other han...
متن کامل